package band.wukong.practice.javase.core.thread.status;

import java.io.IOException;

/**
 * Desc: 因为IO操作而进入阻塞状态
 * Author: sunjs
 * Date: 2009-11-5 10:45:20
 */
public class BlockedWhenIO extends Thread {
    private static StringBuffer log = new StringBuffer();
    private static int count = 0;

    public void run() {
        for (int a = 0; a < 30; a++) {
            //if (currentThread().getName().equals("Thread-1"))
            System.out.println(Thread.currentThread().getName() + ":" + a);
        }
    }

    public static void main(String[] args) throws IOException {
        BlockedWhenIO machine = new BlockedWhenIO();
        machine.start();
        System.out.println("bbbbbbbbbbbbbbbbbbbb");
        int data = System.in.read();    //运行至此时，主线程进入阻塞状态
        System.out.println("aaaaaaaaaaaaaaaaaaaa");
        machine.run();
    }
}
